<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Decent File Transfer Server</title>
</head>
<body>
<h1>Decent File Transfer Server</h1>
<table>
    <thead>
        <tr>
            <td>文件名</td>
            <td>校验和</td>
            <td>大小</td>
            <td>文件类型</td>
        </tr>
    </thead>
    <tbody id="main"></tbody>
</table>
</body>
<script>
    fetch('search').then(r => r.json()).then(d => {
        let main = document.getElementById('main')
        for (const each of d.Files) {
            let filename = document.createElement('td')
            let f = document.createElement('a')
            f.href = 'search/' + each.FileName
            f.innerText = each.FileName
            filename.appendChild(f)
            let checksum = document.createElement('td')
            checksum.innerText = each.Checksum
            let size = document.createElement('td')
            size.innerText = each.Size
            let filetype = document.createElement('td')
            filetype.innerText = each.Type
            let tr = document.createElement('tr')
            tr.appendChild(filename)
            tr.appendChild(checksum)
            tr.appendChild(size)
            tr.appendChild(filetype)
            main.appendChild(tr)
        }
    })
</script>
</html>